#ifndef _KERNEL_H_
#define _KERNEL_H_
#include <stdio.h>
#include <stdlib.h>
#include <spu_mfcio.h>

#include <csp_shared_types.h>

/* TAG-IDs */
#define TAGID_MAIN 31


extern int __init(void* prgm_init, qword first_stackframe);
extern int __resume(int ret_val);

#ifdef DEBUG
extern unsigned int _end;
#endif

void fetch_tasks(int status, int val);

typedef struct spu_pcb{
	/* The dedicated registers: $r0 (link reg), $r1 (stackp.), 
	 * $r2 (env. pointer). */
	// 3*16=48 bytes:
	qword  d_regs[VOLATILEREGISTERS];

	/* Description with effective addresses on spe to where we read/write
	 * registers, heap, stack and code. */
	pcb_t process_data __attribute__ ((aligned(128)));
	

	/* Effective address of current process */
	ea_addr_t program;

	/**/
	unsigned char has_process;
} spu_pcb_t __attribute__ ((aligned(128)));



#endif
